package com.bw.visitor_module.visitor

import com.bw.visitor_module.visitor.entity.CarEntity
import com.bw.visitor_module.visitor.entity.DeptEntity
import com.bw.visitor_module.visitor.entity.VisitorEntity
import com.kf.common.entity.BaseEntity
import com.kf.common.mvi.model.BaseModel
import com.kf.lib_network.retrofit.HttpType
import com.kf.lib_network.retrofit.RetrofitFactory
import kotlinx.coroutines.flow.Flow

class VisitorModel :BaseModel(){
    fun requestDept(map: HashMap<String, Any>): Flow<BaseEntity<List<DeptEntity>>> {
        return RetrofitFactory()
            .createRetrofit(HttpType.NONE)
            .create(ApiService::class.java)
            .requestDept(createBody(map))
    }

    fun requestVisitor(map: HashMap<String, Any>): Flow<BaseEntity<VisitorEntity>> {
        return RetrofitFactory()
            .createRetrofit(HttpType.TOKEN)
            .create(ApiService::class.java)
            .requestVisitor(createBody(map))
    }

    fun requestCar(map: HashMap<String, Any>): Flow<BaseEntity<CarEntity>> {
        return RetrofitFactory()
            .createRetrofit(HttpType.TOKEN)
            .create(ApiService::class.java)
            .requestCar(createBody(map))
    }
}